package com.example.bookservice.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;

/**
 * <p>
 * 
 * </p>
 *
 * @author 软工2104-李家强-2100770248
 * @since 2023-09-20
 */
@Data
@TableName("book")
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "Book对象", description = "Book对象")
public class Book implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("书籍ID")
    @TableId("book_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long bookId;

    @ApiModelProperty("标题")
    @TableField("title")
    @NotBlank(message = "请输入图书名字")
    private String title;

    @ApiModelProperty("图书封面")
    @TableField("photo")
    private String photo;

    @ApiModelProperty("作者")
    @TableField("author")
    private String author;

    @ApiModelProperty("发布日期")
    @TableField("publication_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime publicationDate;

    @ApiModelProperty("修改日期")
    @TableField("publication_date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @ApiModelProperty("种类")
    @TableField("category")
    @NotBlank(message = "请选择图书种类")
    private String category;

    @ApiModelProperty("是否已审核")
    @TableField("is_approved")
    private Boolean isApproved;

    @ApiModelProperty("是否可用")
    @TableField("is_available")
    private Boolean isAvailable;

    @ApiModelProperty("浏览数")
    @TableField("reade_count")
    private Integer readeCount;

    @ApiModelProperty("平均评分")
    @TableField("average_mark")
    private Double averageMark;

}
